<!--包含头部文件-->
{include file="public/header" /}
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>用户管理 <span class="c-gray en">&gt;</span> 会员列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
    <div class="text-c">
        <form action="?" method="get">

            <div  style="display: inline-block">
                用户昵称：
                <input type="text" name="nickname" id="nickname" value="{$gets.nickname|default=''}" class="input-text" placeholder="请输入昵称" style="width:100px;">
            </div>
            <div  style="display: inline-block">
                手机号：
                <input type="text" name="phone" id="phone" value="{$gets.phone|default=''}" class="input-text" placeholder="请输入手机号" style="width:100px;">
            </div>
            <div  style="display: inline-block">
                是否绑定：
                <span class="select-box inline">
                    <select name="tb_band" class="select sort">
                        <option value="0" {if condition="$gets['tb_band'] == 0" } selected{/if}>未绑定</option>
                        <option value="1" {if condition="$gets['tb_band'] == 1" } selected{/if}>已绑定</option>
                    </select>
		        </span>
            </div>
            <div  style="display: inline-block">
                是否禁用：
                <span class="select-box inline">
                    <select name="status" class="select sort">
                        <option value="0" {if condition="$gets['status'] == 0" } selected{/if}>是</option>
                        <option value="1" {if condition="$gets['status'] == 1" } selected{/if}>否</option>
                    </select>
		        </span>
            </div>
            <button class="btn btn-success" type="submit"><i class="Hui-iconfont">&#xe665;</i> 筛选</button>
        </form>
    </div>

    <div class="cl pd-5 bg-1 bk-gray mt-10">
		<span class="l">
			<a href="javascript:;" onclick="member_add('新增会员','{:url(\'member/member_add\')}',800,600)" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 新增用户</a>
		</span>
        <span class="r">共有数据：<strong>{$total}</strong> 条</span>
    </div>


    <table class="table table-border table-bordered table-bg">
        <thead>
        <tr>
            <th scope="col" colspan="13">商品列表</th>
        </tr>
        <tr class="text-c">
            <!--<th width="25"><input type="checkbox" name="" value=""></th>-->
            <th width="5%">头像</th>
            <th width="8%">昵称</th>
            <th>手机号</th>
            <th>是否绑定</th>
            <th>会员状态</th>
            <th>最近登录时间</th>
            <th>注册时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="list" id="vo"}
        <tr class="text-c">
            <!--<td><input type="checkbox" value="1" name=""></td>-->
            <td><img src="{$vo.headimgurl}" width="100" height="100"></td>
            <td>{$vo.nickname}</td>
            <td>{$vo.phone}</td>
            <td>
                {if condition="$vo['tb_band'] == 1 "} 已绑定
                {else /} 未绑定
                {/if}</td>
            <td>
                {if condition="$vo['status'] == 1 "} 启用
                {else /} 禁用
                {/if}</td>
            </td>
            <td>{$vo.last_login_time|date="Y-m-d H:i:s", ###}</td>
            <td>{$vo.reg_time|date="Y-m-d H:i:s", ###}</td>
            <td>
                <a title="编辑" href="javascript:;" onclick="member_edit('会员编辑','{:url(\'member/member_edit\',[\'id\'=>$vo.id])}','800','500')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a>
                <a title="删除" href="javascript:;" onclick="member_del(this,'{$vo.id}')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <div class="row">
        <div class="col-sm-2" id="pageBox">
            {$page}
        </div>
    </div>
</div>
<!--包含footer文件-->
{include file="public/footer" /}

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__STATIC__/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__STATIC__/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="__STATIC__/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
    /*
     参数解释：
     title	标题
     url		请求的url
     id		需要操作的数据id
     w		弹出层宽度（缺省调默认值）
     h		弹出层高度（缺省调默认值）
     */
    /*会员-增加*/
    function member_add(title,url,w,h){
        layer_show(title,url,w,h);
    }
    /*会员-删除*/
    function member_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            $.ajax({
                type: 'POST',
                url: '{:url("member/member_del")}',
                data:{"id":id},
                dataType: 'json',
                success: function(data){
                    $(obj).parents("tr").remove();
                    layer.msg('已删除!',{icon:1,time:1000});
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }

    /*管理员-编辑*/
    function member_edit(title,url,w,h){
        layer_show(title,url,w,h);
    }

    $(function () {
        $(".tuijian").bind("change",function(){
            var tuijian = $(this).val();
            var id = this.dataset.id;
            $.ajax({
                type: 'POST',
                url: '{:url("operate/set_tuijian")}',
                data:{"id":id,"tuijian":tuijian},
                dataType: 'json',
                success: function(data){
                    if (data.code=200){
                        layer.msg('设置成功!',{icon:1,time:1000});
                    }else {
                        layer.alert('设置失败'+data.msg+'',{
                            skin: 'layui-layer-molv' //样式类名 自定义样式
                            ,closeBtn: 0  // 是否显示关闭按钮
                            ,anim: 1 //动画类型
                            ,btn: '确认'//按钮
                            ,icon: 6  // icon
                        })
                    }

                },
                error:function(data) {
                    layer.alert('请求失败',{
                        skin: 'layui-layer-molv' //样式类名 自定义样式
                        ,closeBtn: 0  // 是否显示关闭按钮
                        ,anim: 1 //动画类型
                        ,btn: '确认'//按钮
                        ,icon: 6  // icon
                    })
                },
            });
        });
    })


</script>
</body>
</html>